/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Generation.Production.impl;

import EA_Model.IEC61970.Core.impl.CurveImpl;

import EA_Model.IEC61970.Domain.AbsoluteDateTime;

import EA_Model.IEC61970.Generation.Production.FuelAllocationSchedule;
import EA_Model.IEC61970.Generation.Production.FuelType;
import EA_Model.IEC61970.Generation.Production.ProductionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Fuel Allocation Schedule</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.FuelAllocationScheduleImpl#getFuelAllocationEndDate <em>Fuel Allocation End Date</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.FuelAllocationScheduleImpl#getFuelAllocationStartDate <em>Fuel Allocation Start Date</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.FuelAllocationScheduleImpl#getFuelType <em>Fuel Type</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.FuelAllocationScheduleImpl#getMaxFuelAllocation <em>Max Fuel Allocation</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.FuelAllocationScheduleImpl#getMinFuelAllocation <em>Min Fuel Allocation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FuelAllocationScheduleImpl extends CurveImpl implements FuelAllocationSchedule {
	/**
	 * The cached value of the '{@link #getFuelAllocationEndDate() <em>Fuel Allocation End Date</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFuelAllocationEndDate()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime fuelAllocationEndDate;

	/**
	 * The cached value of the '{@link #getFuelAllocationStartDate() <em>Fuel Allocation Start Date</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFuelAllocationStartDate()
	 * @generated
	 * @ordered
	 */
	protected AbsoluteDateTime fuelAllocationStartDate;

	/**
	 * The default value of the '{@link #getFuelType() <em>Fuel Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFuelType()
	 * @generated
	 * @ordered
	 */
	protected static final FuelType FUEL_TYPE_EDEFAULT = FuelType.COAL;

	/**
	 * The cached value of the '{@link #getFuelType() <em>Fuel Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFuelType()
	 * @generated
	 * @ordered
	 */
	protected FuelType fuelType = FUEL_TYPE_EDEFAULT;

	/**
	 * The cached value of the '{@link #getMaxFuelAllocation() <em>Max Fuel Allocation</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxFuelAllocation()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float maxFuelAllocation;

	/**
	 * The cached value of the '{@link #getMinFuelAllocation() <em>Min Fuel Allocation</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinFuelAllocation()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float minFuelAllocation;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FuelAllocationScheduleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductionPackage.Literals.FUEL_ALLOCATION_SCHEDULE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getFuelAllocationEndDate() {
		if (fuelAllocationEndDate != null && fuelAllocationEndDate.eIsProxy()) {
			InternalEObject oldFuelAllocationEndDate = (InternalEObject)fuelAllocationEndDate;
			fuelAllocationEndDate = (AbsoluteDateTime)eResolveProxy(oldFuelAllocationEndDate);
			if (fuelAllocationEndDate != oldFuelAllocationEndDate) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE, oldFuelAllocationEndDate, fuelAllocationEndDate));
			}
		}
		return fuelAllocationEndDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetFuelAllocationEndDate() {
		return fuelAllocationEndDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFuelAllocationEndDate(AbsoluteDateTime newFuelAllocationEndDate) {
		AbsoluteDateTime oldFuelAllocationEndDate = fuelAllocationEndDate;
		fuelAllocationEndDate = newFuelAllocationEndDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE, oldFuelAllocationEndDate, fuelAllocationEndDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime getFuelAllocationStartDate() {
		if (fuelAllocationStartDate != null && fuelAllocationStartDate.eIsProxy()) {
			InternalEObject oldFuelAllocationStartDate = (InternalEObject)fuelAllocationStartDate;
			fuelAllocationStartDate = (AbsoluteDateTime)eResolveProxy(oldFuelAllocationStartDate);
			if (fuelAllocationStartDate != oldFuelAllocationStartDate) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE, oldFuelAllocationStartDate, fuelAllocationStartDate));
			}
		}
		return fuelAllocationStartDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteDateTime basicGetFuelAllocationStartDate() {
		return fuelAllocationStartDate;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFuelAllocationStartDate(AbsoluteDateTime newFuelAllocationStartDate) {
		AbsoluteDateTime oldFuelAllocationStartDate = fuelAllocationStartDate;
		fuelAllocationStartDate = newFuelAllocationStartDate;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE, oldFuelAllocationStartDate, fuelAllocationStartDate));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FuelType getFuelType() {
		return fuelType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFuelType(FuelType newFuelType) {
		FuelType oldFuelType = fuelType;
		fuelType = newFuelType == null ? FUEL_TYPE_EDEFAULT : newFuelType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_TYPE, oldFuelType, fuelType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getMaxFuelAllocation() {
		if (maxFuelAllocation != null && maxFuelAllocation.eIsProxy()) {
			InternalEObject oldMaxFuelAllocation = (InternalEObject)maxFuelAllocation;
			maxFuelAllocation = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldMaxFuelAllocation);
			if (maxFuelAllocation != oldMaxFuelAllocation) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION, oldMaxFuelAllocation, maxFuelAllocation));
			}
		}
		return maxFuelAllocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetMaxFuelAllocation() {
		return maxFuelAllocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxFuelAllocation(EA_Model.IEC61970.Domain.Float newMaxFuelAllocation) {
		EA_Model.IEC61970.Domain.Float oldMaxFuelAllocation = maxFuelAllocation;
		maxFuelAllocation = newMaxFuelAllocation;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION, oldMaxFuelAllocation, maxFuelAllocation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getMinFuelAllocation() {
		if (minFuelAllocation != null && minFuelAllocation.eIsProxy()) {
			InternalEObject oldMinFuelAllocation = (InternalEObject)minFuelAllocation;
			minFuelAllocation = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldMinFuelAllocation);
			if (minFuelAllocation != oldMinFuelAllocation) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION, oldMinFuelAllocation, minFuelAllocation));
			}
		}
		return minFuelAllocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetMinFuelAllocation() {
		return minFuelAllocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinFuelAllocation(EA_Model.IEC61970.Domain.Float newMinFuelAllocation) {
		EA_Model.IEC61970.Domain.Float oldMinFuelAllocation = minFuelAllocation;
		minFuelAllocation = newMinFuelAllocation;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION, oldMinFuelAllocation, minFuelAllocation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE:
				if (resolve) return getFuelAllocationEndDate();
				return basicGetFuelAllocationEndDate();
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE:
				if (resolve) return getFuelAllocationStartDate();
				return basicGetFuelAllocationStartDate();
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_TYPE:
				return getFuelType();
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION:
				if (resolve) return getMaxFuelAllocation();
				return basicGetMaxFuelAllocation();
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION:
				if (resolve) return getMinFuelAllocation();
				return basicGetMinFuelAllocation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE:
				setFuelAllocationEndDate((AbsoluteDateTime)newValue);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE:
				setFuelAllocationStartDate((AbsoluteDateTime)newValue);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_TYPE:
				setFuelType((FuelType)newValue);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION:
				setMaxFuelAllocation((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION:
				setMinFuelAllocation((EA_Model.IEC61970.Domain.Float)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE:
				setFuelAllocationEndDate((AbsoluteDateTime)null);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE:
				setFuelAllocationStartDate((AbsoluteDateTime)null);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_TYPE:
				setFuelType(FUEL_TYPE_EDEFAULT);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION:
				setMaxFuelAllocation((EA_Model.IEC61970.Domain.Float)null);
				return;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION:
				setMinFuelAllocation((EA_Model.IEC61970.Domain.Float)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_END_DATE:
				return fuelAllocationEndDate != null;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_ALLOCATION_START_DATE:
				return fuelAllocationStartDate != null;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__FUEL_TYPE:
				return fuelType != FUEL_TYPE_EDEFAULT;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MAX_FUEL_ALLOCATION:
				return maxFuelAllocation != null;
			case ProductionPackage.FUEL_ALLOCATION_SCHEDULE__MIN_FUEL_ALLOCATION:
				return minFuelAllocation != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (fuelType: ");
		result.append(fuelType);
		result.append(')');
		return result.toString();
	}

} //FuelAllocationScheduleImpl
